//
//  AppDelegate.m
//  Project_Demo
//
//  Created by caoxiaozhu on 2018/6/29.
//  Copyright © 2018年 caoxiaozhu. All rights reserved.
//

#import "AppDelegate.h"
#import "OpenShare.h"


@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    
    _baseTabBar = [XZ_BaseTabbarController new];
    self.window.rootViewController = _baseTabBar;
    
    //第一步：注册key
    [OpenShare connectQQWithAppId:@"1103194207"];
    [OpenShare connectWeiboWithAppKey:@"402180334"];
    [OpenShare connectWeixinWithAppId:@"wx812c0aa46db0ee40" miniAppId:@"gh_d43f693ca31f"];
    [OpenShare connectRenrenWithAppId:@"228525" AndAppKey:@"1dd8cba4215d4d4ab96a49d3058c1d7f"];
    [OpenShare connectAlipay];//支付宝参数都是服务器端生成的，这里不需要key.
    
    //设置iq键盘
    [self setKeyBoardStyle];
    //注册云端储存
    [self setLeanCloud:launchOptions];
    return YES;
    
    //通知传值
//    [[NSNotificationCenter defaultCenter]postNotificationName:@"sendAD" object:nil userInfo:];
    
    [self.delegate senAd:@{@"ad1":@"baidu",@"ad2":@"qq"}];
}

-(void)setLeanCloud:(NSDictionary *)launchOptions{
    //配置
    [AVOSCloud setApplicationId:@"5aMYSyjBqmDgAKDpsUJ1vKlO-gzGzoHsz" clientKey:@"jpJ6ByGeel3c2Urs7BlgmnNg"];
    //应用统计
    [AVAnalytics trackAppOpenedWithLaunchOptions:launchOptions];
}

-(void)setKeyBoardStyle{
    IQ_KeyboardManager.enable = YES;
    // 控制点击背景是否收起键盘
    IQ_KeyboardManager.shouldResignOnTouchOutside = YES;
    // 控制是否显示键盘上的工具条
    IQ_KeyboardManager.enableAutoToolbar = YES;
    // 有多个输入框时，可以通过点击Toolbar 上的“前一个”“后一个”按钮来实现移动到不同的输入框
    IQ_KeyboardManager.toolbarManageBehaviour = IQAutoToolbarBySubviews;
    //完成按钮文字
    IQ_KeyboardManager.toolbarDoneBarButtonItemText = @"完成";
    IQ_KeyboardManager.toolbarTintColor = Color_Black;
    // 控制键盘上的工具条文字颜色是否用户自定义
    IQ_KeyboardManager.shouldToolbarUsesTextFieldTintColor = NO;
    // 是否显示占位文字
//    keyboardManager.shouldShowTextFieldPlaceholder = YES;
    // 设置占位文字的字体
//    KeyboardManager.placeholderFont = [UIFont boldSystemFontOfSize:17];
    // 输入框距离键盘的距离
    IQ_KeyboardManager.keyboardDistanceFromTextField = 10.0f;
}




- (void)applicationDidEnterBackground:(UIApplication *)application {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}


- (void)applicationWillEnterForeground:(UIApplication *)application {
    // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}


- (void)applicationDidBecomeActive:(UIApplication *)application {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}




@end
